package com.hb.trade.server.project.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * 发票接口url
 *
 * @author jinhaolin
 * @date 2022/4/6 0006 13:34
 **/
@Configuration
public class InvoiceConfig {

    public static String invoiceBaseUrl;

    // 开发票接口地址
    public static final String INVOICING_URL = "/invoicing";

    // 获取电子发票pdf地址
    public static final String INVOICE_PDF_URL = "/getElectronicInvoice";

    // 税控设备编号
    public static String  fiscalProcessorCode;

    // 购方单位名称
    public static String sellerName;

    // 购方单位识别号
    public static String sellerIdentification;

    // 购方地址
    public static String sellerAddress;

    // 购方电话
    public static String sellerPhone;

    // 购方银行及账号
    public static String sellerBankAccount;
    // 商品编码
    public static String spbm;

    //1:测试环境 2:正式环境
    public static String ceShiFlag;
    @Value("${invoice.ce_shi_flag:1}")
    public  void setCeShiFlag(String ceShiFlag) {
        InvoiceConfig.ceShiFlag = ceShiFlag;
    }

    @Value("${invoice.base_url}")
    public void setInvoiceBaseUrl(String invoiceBaseUrl) {
        InvoiceConfig.invoiceBaseUrl = invoiceBaseUrl;
    }

    @Value("${invoice.fiscal_processor_code}")
    public void setFiscalProcessorCode(String fiscalProcessorCode) {
        InvoiceConfig.fiscalProcessorCode = fiscalProcessorCode;
    }

    @Value("${invoice.seller_name}")
    public void setSellerName(String sellerName) {
        InvoiceConfig.sellerName = sellerName;
    }

    @Value("${invoice.seller_identification}")
    public void setSellerIdentification(String sellerIdentification) {
        InvoiceConfig.sellerIdentification = sellerIdentification;
    }

    @Value("${invoice.seller_address}")
    public void setSellerAddress(String sellerAddress) {
        InvoiceConfig.sellerAddress = sellerAddress;
    }

    @Value("${invoice.seller_phone}")
    public void setSellerPhone(String sellerPhone) {
        InvoiceConfig.sellerPhone = sellerPhone;
    }

    @Value("${invoice.seller_bank_account}")
    public void setSellerBankAccount(String sellerBankAccount) {
        InvoiceConfig.sellerBankAccount = sellerBankAccount;
    }

    @Value("${invoice.spbm}")
    public  void setSpbm(String spbm) {
        InvoiceConfig.spbm = spbm;
    }

    public static String invoicingUrl() {
        return invoiceBaseUrl + INVOICING_URL;
    }

    public static String invoicePdfUrl() {
        return invoiceBaseUrl + INVOICE_PDF_URL;
    }

}
